<template>
    <view class="doctor mt-32">
        <view class="f jc-s-b ai-c">
            <view class="fs-36 fw-600 text-color4">名医在线</view>
            <view class="f ai-c" @click="toDoctor">
                <view class="fs-24 text-color3 mr-9"> 更多</view>
                <u-icon name="arrow-right" size="10" color="#999"></u-icon>
            </view>
        </view>
        <view class="mt-16 f ai-c jc-s-b ph-28 pv-28 line b-24" v-for="(item, index) in list" :key="index" @click="toDetail(item)">
            <image :src="item.avatar" class="w-120 h-120 b-12" mode="aspectFill"></image>
            <view class="f f1 fd-c ml-20">
                <view class="fs-30 fw-600 text-color4">{{ item.name }}</view>
                <view class="mt-8 fs-24 text-color3 text-ellipsis-2">
                    {{ item.introduction }}
                </view>
            </view>
        </view>
    </view>
</template>
<script setup lang="ts">
import {ref, toRefs} from 'vue';
import {doctorPage} from "@/services/api/index";
const list = ref([]);
getData();

async function getData() {
  const { data } = await doctorPage({
    pageNo: 1,
    pageSize: 5,
		isFamous:1
  });
  console.log(data.list)
  list.value=data.list;
}
function toDetail(data: any) {
    uni.navigateTo({
        url: `/pages_index/doctorDetail?id=${data.id}`,
    });
}
const toDoctor = () => {
    uni.navigateTo({
        url: '/pages_index/doctor',
    });
};
</script>
<style lang="scss" scoped>
.doctor {
    .line {
        background: #fff;
    }
}
</style>
